<?php

namespace App\Providers;

use App\UserProviders\PhoneCodeProvider;
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        // 'App\Models\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        // 增加短信验证登陆
        Auth::provider('phoneCode', function ($app, array $config){
                return new PhoneCodeProvider($app->make(ConnectionInterface::class), $app->make(HasherContract::class),'user');
        });

        // 新增用户看守器
        /*Auth::extend('authorized_api', function ($app, $name, array $config){
            return
        });*/
    }
}
